package logic

import (
	"context"
	"goods_srv/modile/redis"

	"goods_srv/goods"
	"goods_srv/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type DelGoodsStockLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewDelGoodsStockLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DelGoodsStockLogic {
	return &DelGoodsStockLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *DelGoodsStockLogic) DelGoodsStock(in *goods.DelGoodsStockRequest) (*goods.DelGoodsStockResponse, error) {
	// todo: 删除商品库存

	redis.DelGoodsStock(int(in.GoodsId), int(in.Num))

	return &goods.DelGoodsStockResponse{}, nil
}
